from rest_framework.pagination import PageNumberPagination
from rest_framework.response import Response


class PageNum(PageNumberPagination):
    """自定义分页类"""
    page_size = 5
    page_size_query_param = 'pagesize'
    max_page_size = 10
    #
    # def get_paginated_response(self, data):
    #     """重写返回方法"""
    #     return Response({
    #         'count': self.page.paginator.count,  # 总共多少条数据
    #         'lists': data,  # 用户的数据
    #         'page': self.page.number,  # 当前页数
    #         'pages': self.page.paginator.num_pages,
    #         'pagesize': self.page_size,
    #     })
